Instructions for creating an example program for firehose.

This example assumes that you have the 'firehose' executable in your
path. If you are using the 'snabb' executable then use a syntax like
'snabb firehose' or './snabb firehose' instead as appropirate.

Step 1: Create firehose.h

  Create firehose.h with this command:
  $ firehose -H > firehose.h

Step 2: Create firehose_example.c

  Create the file firehose_example.c with these contents:

    #include <stdio.h>
    #include "firehose.h" // generated by 'firehose -h'

    static int packets;
    void firehose_start() { printf("Starting\n"); }
    void firehose_stop()  { printf("Stopping after %d packets\n", packets); }
    void firehose_packet(const char *pci, char *data, int length) { packets++; }

Step 3: Compile the callback library

 Compile firehose_example.so callback shared library:
  $ gcc -O2 -fPIC -shared -o firehose_example.so firehose_example.c

Step 4: Run the example on one or more 10G ports

  Indentify the PCI addresses of the (Intel 82599) network ports that
  you want to test with and run firehose:

  $ sudo firehose -i 0000:01:00.0 -i 0000:01:00.1 \
                  -i 0000:02:00.0 -i 0000:02:00.1 \
                  -t 1 ./firehose_example.so
  Loading shared object: ./firehose_example.so
  Initializing NIC: 0000:01:00.0
  Initializing NIC: 0000:01:00.1
  Initializing NIC: 0000:02:00.0
  Initializing NIC: 0000:02:00.1
  Initializing callback library
  Starting
  Processing traffic...
  Stopping after 41136315 packets

  which shows 41 million packets being processed in one
  second. (This is not the performance limit: that was the total
  traffic being received on the links for this example.)
